<template>
  <div class="">
    <!-- 面包屑 -->
    <el-breadcrumb separator="/" style="font-size: 12px">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片 -->
    <el-card style="margin-top: 10px">
      <!-- 表格 -->
      <el-table :data="rightsList">
        <el-table-column label="#" type="index" width="50px"></el-table-column>
        <el-table-column
          label="权限名称"
          prop="authName"
          width="300px"
        ></el-table-column>
        <el-table-column
          label="路径"
          prop="path"
          width="300px"
        ></el-table-column>
        <el-table-column label="权限等级" prop="index" width="200px">
          <template slot-scope="scope">
            <div>
              <el-tag :type="typeObj[scope.row.level]">
                {{ scope.row.level | rank }}</el-tag
              >
            </div>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      rightsList: [],
      typeObj: {
        0: "primary",
        1: "success",
        2: "warning",
      },
    };
  },
  created() {
    this.getRightsList();
  },
  methods: {
    //   渲染
    async getRightsList() {
      const res = await this.$API.getRightsListApi();
      console.log("权限列表", res);
      this.rightsList = res;
    },
  },
  components: {},
};
</script>

<style lang='scss'>
</style>
